/**
 * Form 配置
 * @param t
 * @returns {[{field: string, type: string, title, value: string},{field: string, options: [{label: string, value: string},{label: string, value: string},{label: string, value: string}], type: string, title, value: string},{field: string, type: string, title, value: boolean},{field: string, options: [{label: string, value: string},{label: string, value: string}], type: string, title, value: string},{field: string, type: string, title, value: boolean},null,null]}
 */
export default function form({ t }) {
  return [
    {
      type: "input",
      field: "formName",
      value: "form",
      title: t("form.formName"),
    },
    {
      type: "radio",
      field: "layout",
      title: t("form.layout"),
      value: "horizontal",
      options: [
        {
          label: "水平",
          value: "horizontal",
        },
        {
          label: "垂直",
          value: "vertical",
        },
        {
          label: "多列",
          value: "inline",
        },
      ],
    },
    {
      type: "switch",
      field: "autoLabelWidth",
      value: true,
      title: t("form.autoLabelWidth"),
    },
    {
      type: "radio",
      field: "labelAlign",
      value: "left",
      title: t("form.labelAlign"),
      options: [
        {
          value: "left",
          label: "左",
        },
        {
          value: "right",
          label: "右",
        },
      ],
    },
    {
      type: "switch",
      field: "scroll-to-first-error",
      value: false,
      title: t("form.scrollToFirstError"),
    },
    {
      type: "switch",
      field: "formCreateSubmitBtn",
      value: true,
      title: t("form.submitBtn"),
    },
    {
      type: "switch",
      field: "formCreateResetBtn",
      value: true,
      title: t("form.resetBtn"),
    },
    {
      type: "FnConfig",
      field: "_event",
      value: {},
      col: { show: true },
      props: {
        eventConfig: [
          {
            name: "onSubmit",
            args: ["formData", "api"],
          },
          {
            name: "onCreated",
            args: ["api"],
          },
          {
            name: "onMounted",
            args: ["api"],
          },
          {
            name: "onChange",
            args: ["field", "value", "options"],
          },
          {
            name: "beforeFetch",
            args: ["config", "data"],
          },
        ],
      },
      title: t("form.event"),
    },
  ];
}
